<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>百度换肤</title>
		<style type="text/css">
			* {
				margin: 0;
				padding: 0;
			}

			body {
				background: url(../images/product01.png) no-repeat center top;
			}

			li {
				list-style: none;
			}

			.baidu {
				overflow: hidden;
				margin: 100px auto;
				background-color: #fff;
				width: 450px;
				padding-top: 3px;
			}

			.baidu li {
				float: left;
				margin: 0 auto;
				margin-left: 10px;
				cursor: pointer;
			}

			.baidu img {
				width: 100px;
			}
		</style>
	</head>
	<body>
		<ul class="baidu">
			<li><img src="../images/product01.png"></li>
			<li><img src="../images/product02.png"></li>
			<li><img src="../images/product03.png"></li>
			<li><img src="../images/product04.png"></li>
		</ul>
		<script type="text/javascript">
			var imgs = document.querySelector('.baidu').querySelectorAll('img');
			for (var i = 0; i < imgs.length; i++) {
				imgs[i].onclick = function() {
					document.body.style.backgroundImage = 'url(' + this.src + ')';
				}
			}
		</script>
	</body>
</html>
